##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.548   4.854   7.271   9.825  10.160 132.499
## [1] 40758
# correlation plots
alpha = 0.05

ya_mat <- cor(select(ya_data, -record_id, -files, -matches("zscore|z_score"), trails_b_z_score, -Group))
ya_res <- cor.mtest(ya_mat, conf.level = (1-alpha))
corrplot(ya_mat, p.mat = ya_res$p, sig.level = alpha, insig = "blank", type = "upper")

oa_mat <- cor(select(oa_data, -record_id, -files, -Group))
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")

#addCoef.col = TRUE, number.cex = .6

Confidence Intervals for Correlations

In older adults, which FA or MD measures are correlated with neuropsych measures?

library(corxplor)
## Loading required package: tidyselect
oa_data <- filter(d, Group == "Older Adults")
oa_cor_data <- select(oa_data, matches("fa_mean|md_mean"), matches("zscore|z_score"))
boot <- corxplor::cor_boot(x = oa_cor_data, y = NULL, use = "pairwise", method = "pearson",
                     n_rep = 1000, conf = 0.95, seed = 42, n_cores = NULL)
boot
##                                                     correlates     r
## 1                                      fa_mean_3 <-> fa_mean_5  0.90
## 2                cvlt_ldelay_cue_recall_zscore <-> cvlt_zscore  0.89
## 3                                      fa_mean_3 <-> fa_mean_4  0.89
## 4    cvlt_sdelay_cued_zscore <-> cvlt_ldelay_cue_recall_zscore  0.89
## 5  cvlt_ldelay_recall_zscore <-> cvlt_ldelay_cue_recall_zscore  0.89
## 6                    cvlt_ldelay_recall_zscore <-> cvlt_zscore  0.88
## 7                      cvlt_sdelay_cued_zscore <-> cvlt_zscore  0.88
## 8                    cvlt_sdelay_recall_zscore <-> cvlt_zscore  0.87
## 9                                      fa_mean_4 <-> fa_mean_5  0.87
## 10       cvlt_sdelay_cued_zscore <-> cvlt_ldelay_recall_zscore  0.82
## 11                                     md_mean_3 <-> md_mean_4  0.82
## 12                                     md_mean_4 <-> md_mean_5  0.80
## 13                                     fa_mean_4 <-> md_mean_4 -0.79
## 14     cvlt_sdelay_recall_zscore <-> cvlt_ldelay_recall_zscore  0.79
## 15       cvlt_sdelay_recall_zscore <-> cvlt_sdelay_cued_zscore  0.79
## 16 cvlt_sdelay_recall_zscore <-> cvlt_ldelay_cue_recall_zscore  0.77
## 17                                     fa_mean_3 <-> md_mean_4 -0.75
## 18                                     md_mean_3 <-> md_mean_5  0.72
## 19                                   fa_mean_4 <-> fa_mean_sca  0.70
## 20                                     fa_mean_3 <-> md_mean_5 -0.68
## 21                                     fa_mean_5 <-> md_mean_5 -0.68
## 22                cvlt_recognition_hits_zscore <-> cvlt_zscore  0.67
## 23                                     fa_mean_5 <-> md_mean_4 -0.64
## 24                                     fa_mean_3 <-> md_mean_3 -0.63
## 25                                   fa_mean_3 <-> fa_mean_sca  0.62
##            95% CI
## 1    [0.81, 0.95]
## 2    [0.81, 0.93]
## 3    [0.81, 0.94]
## 4     [0.8, 0.94]
## 5     [0.8, 0.94]
## 6     [0.8, 0.93]
## 7    [0.81, 0.92]
## 8    [0.79, 0.91]
## 9    [0.76, 0.92]
## 10    [0.72, 0.9]
## 11    [0.67, 0.9]
## 12   [0.68, 0.87]
## 13 [-0.87, -0.67]
## 14    [0.7, 0.86]
## 15   [0.65, 0.87]
## 16   [0.62, 0.85]
## 17 [-0.84, -0.64]
## 18   [0.57, 0.83]
## 19   [0.51, 0.81]
## 20 [-0.81, -0.51]
## 21 [-0.83, -0.47]
## 22    [0.5, 0.77]
## 23 [-0.76, -0.45]
## 24 [-0.76, -0.43]
## 25   [0.41, 0.75]
## ............................................
##  (181 correlations omitted)
## ............................................
##                                         correlates     r        95% CI
## 207        md_mean_4 <-> cvlt_sdelay_recall_zscore  0.03 [-0.25, 0.31]
## 208      md_mean_sca <-> cvlt_ldelay_recall_zscore  0.02  [-0.31, 0.3]
## 209                      fa_mean_5 <-> cvlt_zscore  0.02 [-0.16, 0.22]
## 210    md_mean_3 <-> cvlt_ldelay_cue_recall_zscore  0.02  [-0.3, 0.33]
## 211                      md_mean_3 <-> cvlt_zscore -0.02 [-0.33, 0.28]
## 212    fa_mean_5 <-> cvlt_ldelay_cue_recall_zscore  0.02 [-0.19, 0.26]
## 213               md_mean_sca <-> trails_a_z_score -0.02  [-0.26, 0.2]
## 214   md_mean_sca <-> cvlt_recognition_hits_zscore -0.02  [-0.31, 0.3]
## 215        md_mean_5 <-> cvlt_sdelay_recall_zscore -0.02 [-0.29, 0.26]
## 216        md_mean_5 <-> cvlt_ldelay_recall_zscore -0.02 [-0.31, 0.24]
## 217        md_mean_3 <-> cvlt_sdelay_recall_zscore -0.02  [-0.3, 0.25]
## 218        fa_mean_sca <-> cvlt_sdelay_cued_zscore -0.01  [-0.29, 0.3]
## 219          md_mean_3 <-> cvlt_sdelay_cued_zscore  0.01  [-0.3, 0.33]
## 220                 md_mean_5 <-> trails_b_z_score  0.01 [-0.23, 0.24]
## 221          fa_mean_4 <-> cvlt_sdelay_cued_zscore  0.01 [-0.25, 0.27]
## 222       md_mean_4 <-> cvlt_recognition_fp_zscore  0.01 [-0.24, 0.24]
## 223    md_mean_5 <-> cvlt_ldelay_cue_recall_zscore  0.00  [-0.3, 0.34]
## 224                    md_mean_3 <-> cvlt_b_zscore  0.00 [-0.28, 0.31]
## 225                      md_mean_5 <-> cvlt_zscore  0.00  [-0.28, 0.3]
## 226                      fa_mean_3 <-> cvlt_zscore  0.00 [-0.21, 0.19]
## 227                 fa_mean_5 <-> trails_b_z_score  0.00 [-0.21, 0.29]
## 228                 md_mean_3 <-> trails_b_z_score  0.00 [-0.27, 0.27]
## 229 cvlt_sdelay_recall_zscore <-> trails_a_z_score  0.00 [-0.23, 0.19]
## 230                      fa_mean_4 <-> cvlt_zscore  0.00 [-0.23, 0.22]
## 231                 fa_mean_3 <-> trails_b_z_score  0.00  [-0.26, 0.3]

In older adults, which CR measures are correlated with FA or MD?

oa_cor_data <- select(oa_data, IS:RA, actamp:fact, matches("fa_mean|md_mean"))
boot <- corxplor::cor_boot(x = oa_cor_data, y = NULL, use = "pairwise", method = "pearson",
                     n_rep = 1000, conf = 0.95, seed = 42, n_cores = NULL)
## Warning in norm.inter(t, adj.alpha): extreme order statistics used as endpoints

## Warning in norm.inter(t, adj.alpha): extreme order statistics used as endpoints
boot
##                     correlates     r         95% CI
## 1    actalph <-> actwidthratio -1.00       [-1, -1]
## 2              rsqact <-> fact  0.96    [0.9, 0.98]
## 3      actphi <-> actdownmesor  0.93   [0.86, 0.96]
## 4        actphi <-> actupmesor  0.91   [0.86, 0.95]
## 5      fa_mean_3 <-> fa_mean_5  0.90   [0.81, 0.95]
## 6      fa_mean_3 <-> fa_mean_4  0.89   [0.81, 0.94]
## 7      fa_mean_4 <-> fa_mean_5  0.87   [0.76, 0.92]
## 8      md_mean_3 <-> md_mean_4  0.82    [0.67, 0.9]
## 9      md_mean_4 <-> md_mean_5  0.80   [0.68, 0.87]
## 10     fa_mean_4 <-> md_mean_4 -0.79 [-0.87, -0.67]
## 11           actamp <-> rsqact  0.79   [0.64, 0.88]
## 12     fa_mean_3 <-> md_mean_4 -0.75 [-0.84, -0.64]
## 13             actamp <-> fact  0.75   [0.58, 0.84]
## 14     md_mean_3 <-> md_mean_5  0.72   [0.57, 0.83]
## 15         actmin <-> actmesor  0.72   [0.49, 0.83]
## 16               IS <-> rsqact  0.72   [0.42, 0.85]
## 17   fa_mean_4 <-> fa_mean_sca  0.70   [0.51, 0.81]
## 18 actupmesor <-> actdownmesor  0.69   [0.51, 0.82]
## 19     fa_mean_3 <-> md_mean_5 -0.68 [-0.81, -0.51]
## 20     fa_mean_5 <-> md_mean_5 -0.68 [-0.83, -0.47]
## 21     fa_mean_5 <-> md_mean_4 -0.64 [-0.76, -0.45]
## 22     fa_mean_3 <-> md_mean_3 -0.63 [-0.76, -0.43]
## 23                 IS <-> fact  0.63   [0.09, 0.84]
## 24   fa_mean_3 <-> fa_mean_sca  0.62   [0.41, 0.75]
## 25   fa_mean_5 <-> fa_mean_sca  0.59   [0.39, 0.72]
## ............................................
##  (181 correlations omitted)
## ............................................
##                    correlates     r        95% CI
## 207      actmin <-> fa_mean_4 -0.03 [-0.33, 0.22]
## 208             IV <-> actphi  0.03 [-0.27, 0.25]
## 209          RA <-> fa_mean_4 -0.03 [-0.31, 0.31]
## 210  actmin <-> actwidthratio -0.03 [-0.39, 0.36]
## 211           IV <-> actmesor  0.03 [-0.29, 0.38]
## 212      rsqact <-> md_mean_5 -0.02 [-0.27, 0.23]
## 213          RA <-> md_mean_5 -0.02 [-0.33, 0.22]
## 214        IV <-> fa_mean_sca  0.02 [-0.35, 0.32]
## 215      actbeta <-> actmesor -0.02 [-0.29, 0.29]
## 216          actbeta <-> fact  0.02  [-0.2, 0.23]
## 217      actphi <-> md_mean_3 -0.02  [-0.3, 0.26]
## 218    rsqact <-> md_mean_sca  0.02  [-0.28, 0.3]
## 219      actphi <-> md_mean_4  0.02  [-0.26, 0.3]
## 220          IS <-> md_mean_4 -0.01  [-0.3, 0.24]
## 221 actmesor <-> actdownmesor  0.01  [-0.26, 0.3]
## 222          IV <-> md_mean_4  0.01  [-0.34, 0.3]
## 223          RA <-> fa_mean_3  0.01 [-0.25, 0.32]
## 224          RA <-> md_mean_3  0.01 [-0.21, 0.24]
## 225     actbeta <-> md_mean_3  0.01 [-0.19, 0.22]
## 226          IV <-> md_mean_3 -0.01  [-0.3, 0.25]
## 227   actdownmesor <-> rsqact  0.01 [-0.25, 0.27]
## 228          IV <-> md_mean_5  0.00 [-0.26, 0.26]
## 229       RA <-> actdownmesor  0.00 [-0.21, 0.24]
## 230      actphi <-> md_mean_5  0.00 [-0.24, 0.27]
## 231     actdownmesor <-> fact  0.00 [-0.22, 0.24]

Regression Models

lm1 <- lm(md_mean_4 ~ age + actalph, data = oa_data)
summary(lm1)
## 
## Call:
## lm(formula = md_mean_4 ~ age + actalph, data = oa_data)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -4.466e-05 -1.138e-05 -1.322e-06  1.020e-05  4.207e-05 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.783e-04  3.418e-05  11.068 1.09e-14 ***
## age          9.575e-07  5.001e-07   1.914  0.06167 .  
## actalph     -5.872e-05  1.950e-05  -3.011  0.00418 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.95e-05 on 47 degrees of freedom
## Multiple R-squared:  0.2337, Adjusted R-squared:  0.2011 
## F-statistic: 7.167 on 2 and 47 DF,  p-value: 0.00192
AIC(lm1)
## [1] -937.7315
d %>%
  na.omit() %>%
  select(Group, md_mean_3, md_mean_4, md_mean_5, actalph) %>%
  melt(id.vars = c("Group", "actalph")) %>%
  ggplot(aes(color = Group, group = Group)) +
  geom_point(aes(x = actalph, y = value, group = Group, color = Group)) +
  stat_smooth(aes(x = actalph, y = value, group = Group, color= Group), method = "lm") + 
  scale_color_manual(values = c("blue", "red")) +
  facet_wrap(Group ~ variable, scales = "free_y") +
  xlab("Width (alpha)") + ylab("Mean Diffusivity") 

width (alpha) and width-ratio are related

lm2 <- lm(md_mean_4 ~ age + actwidthratio, data = oa_data)
summary(lm2)
## 
## Call:
## lm(formula = md_mean_4 ~ age + actwidthratio, data = oa_data)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -4.475e-05 -1.109e-05 -1.818e-06  9.780e-06  4.240e-05 
## 
## Coefficients:
##                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   2.999e-04  4.603e-05   6.516 4.45e-08 ***
## age           9.539e-07  5.016e-07   1.902  0.06336 .  
## actwidthratio 1.614e-04  5.446e-05   2.964  0.00475 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.954e-05 on 47 degrees of freedom
## Multiple R-squared:  0.2299, Adjusted R-squared:  0.1971 
## F-statistic: 7.014 on 2 and 47 DF,  p-value: 0.00216
d %>%
  na.omit() %>%
  select(Group, md_mean_3, md_mean_4, md_mean_5, actwidthratio) %>%
  melt(id.vars = c("Group", "actwidthratio")) %>%
  ggplot(aes(color = Group, group = Group)) +
  geom_point(aes(x = actwidthratio, y = value, group = Group, color = Group)) +
  stat_smooth(aes(x = actwidthratio, y = value, group = Group, color= Group), method = "lm") + 
  scale_color_manual(values = c("blue", "red")) +
  facet_wrap(Group ~ variable, scales = "free_y") +
  xlab("Width-ratio") + ylab("Mean Diffusivity") 

lm3 <- lm(fa_mean_4 ~ age + actalph, data = oa_data)
summary(lm3) # *
## 
## Call:
## lm(formula = fa_mean_4 ~ age + actalph, data = oa_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.08406 -0.01652 -0.00158  0.02077  0.05122 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.7187206  0.0565489  12.710   <2e-16 ***
## age         -0.0010360  0.0008274  -1.252   0.2167    
## actalph      0.0636989  0.0322615   1.974   0.0542 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03225 on 47 degrees of freedom
## Multiple R-squared:  0.1158, Adjusted R-squared:  0.07813 
## F-statistic: 3.076 on 2 and 47 DF,  p-value: 0.05552
d %>%
  na.omit() %>%
  select(Group, fa_mean_3, fa_mean_4, fa_mean_5, actalph) %>%
  melt(id.vars = c("Group", "actalph")) %>%
  ggplot() +
  geom_point(aes(x = actalph, y = value, group = Group, color = Group)) +
  stat_smooth(aes(x = actalph, y = value, group = Group, color= Group), method = "lm") + 
  scale_color_manual(values = c("blue", "red")) +
  facet_wrap(Group ~ variable, scales = "free_y") +
  xlab("Width (alpha)") + ylab("Fractional Anisotropy") 

Stepwise Regression Models

#older adults
#body - highest correlation values
#width-,age+,RA+NS
#longer durations of low activity predict greater MD
stepdata <- select(oa_data, age, IS:RA, actalph:fact, -rsqact, -actwidthratio, md_mean_4)
summary(slm02 <- lm(md_mean_4 ~ ., data = stepdata))
## 
## Call:
## lm(formula = md_mean_4 ~ ., data = stepdata)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -4.415e-05 -1.024e-05 -3.880e-07  9.977e-06  4.158e-05 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.599e-04  4.791e-05   7.513 2.35e-09 ***
## age          8.583e-07  5.448e-07   1.575  0.12251    
## IS           2.218e-06  3.293e-05   0.067  0.94660    
## IV          -6.015e-06  1.363e-05  -0.441  0.66115    
## RA           3.779e-05  2.771e-05   1.364  0.17970    
## actalph     -6.511e-05  2.055e-05  -3.169  0.00282 ** 
## fact        -1.314e-09  2.066e-09  -0.636  0.52810    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.964e-05 on 43 degrees of freedom
## Multiple R-squared:  0.2885, Adjusted R-squared:  0.1893 
## F-statistic: 2.906 on 6 and 43 DF,  p-value: 0.01812
slm2 <- step(slm02, direction = "both")
## Start:  AIC=-1077.34
## md_mean_4 ~ age + IS + IV + RA + actalph + fact
## 
##           Df  Sum of Sq        RSS     AIC
## - IS       1 1.8000e-12 1.6588e-08 -1079.3
## - IV       1 7.5100e-11 1.6661e-08 -1079.1
## - fact     1 1.5610e-10 1.6742e-08 -1078.9
## <none>                  1.6586e-08 -1077.3
## - RA       1 7.1750e-10 1.7304e-08 -1077.2
## - age      1 9.5720e-10 1.7543e-08 -1076.5
## - actalph  1 3.8729e-09 2.0459e-08 -1068.8
## 
## Step:  AIC=-1079.33
## md_mean_4 ~ age + IV + RA + actalph + fact
## 
##           Df  Sum of Sq        RSS     AIC
## - IV       1 7.3400e-11 1.6661e-08 -1081.1
## - fact     1 2.1620e-10 1.6804e-08 -1080.7
## <none>                  1.6588e-08 -1079.3
## - RA       1 1.0590e-09 1.7647e-08 -1078.2
## - age      1 1.0722e-09 1.7660e-08 -1078.2
## + IS       1 1.8000e-12 1.6586e-08 -1077.3
## - actalph  1 3.9257e-09 2.0513e-08 -1070.7
## 
## Step:  AIC=-1081.11
## md_mean_4 ~ age + RA + actalph + fact
## 
##           Df  Sum of Sq        RSS     AIC
## - fact     1 1.5260e-10 1.6814e-08 -1082.7
## <none>                  1.6661e-08 -1081.1
## - age      1 1.1252e-09 1.7786e-08 -1079.8
## - RA       1 1.1973e-09 1.7858e-08 -1079.6
## + IV       1 7.3400e-11 1.6588e-08 -1079.3
## + IS       1 0.0000e+00 1.6661e-08 -1079.1
## - actalph  1 3.8573e-09 2.0518e-08 -1072.7
## 
## Step:  AIC=-1082.65
## md_mean_4 ~ age + RA + actalph
## 
##           Df  Sum of Sq        RSS     AIC
## <none>                  1.6814e-08 -1082.7
## - RA       1 1.0502e-09 1.7864e-08 -1081.6
## + fact     1 1.5260e-10 1.6661e-08 -1081.1
## + IS       1 5.4400e-11 1.6759e-08 -1080.8
## + IV       1 9.8000e-12 1.6804e-08 -1080.7
## - age      1 1.4206e-09 1.8234e-08 -1080.6
## - actalph  1 4.1180e-09 2.0932e-08 -1073.7
summary(slm2)
## 
## Call:
## lm(formula = md_mean_4 ~ age + RA + actalph, data = stepdata)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -4.276e-05 -9.223e-06 -1.980e-06  1.014e-05  4.239e-05 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  3.438e-04  3.922e-05   8.767 2.25e-11 ***
## age          9.670e-07  4.905e-07   1.971  0.05471 .  
## RA           3.636e-05  2.145e-05   1.695  0.09683 .  
## actalph     -6.563e-05  1.955e-05  -3.357  0.00159 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.912e-05 on 46 degrees of freedom
## Multiple R-squared:  0.2788, Adjusted R-squared:  0.2317 
## F-statistic: 5.926 on 3 and 46 DF,  p-value: 0.001662
AIC(slm2)
## [1] -938.7609
#higher width predicts higher FA
#width+
#longer durations of low activity predict lower FA
stepdata <- select(oa_data, age, IS:RA, actalph:fact, -rsqact, -actwidthratio, fa_mean_4)
summary(slm02 <- lm(fa_mean_4 ~ ., data = stepdata))
## 
## Call:
## lm(formula = fa_mean_4 ~ ., data = stepdata)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.085845 -0.017658 -0.001079  0.018599  0.053401 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  7.207e-01  8.102e-02   8.896 2.66e-11 ***
## age         -8.430e-04  9.213e-04  -0.915   0.3653    
## IS           2.603e-03  5.568e-02   0.047   0.9629    
## IV           3.504e-03  2.304e-02   0.152   0.8798    
## RA          -3.510e-02  4.685e-02  -0.749   0.4578    
## actalph      6.462e-02  3.475e-02   1.860   0.0698 .  
## fact         2.473e-06  3.493e-06   0.708   0.4827    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03321 on 43 degrees of freedom
## Multiple R-squared:  0.1424, Adjusted R-squared:  0.02269 
## F-statistic:  1.19 on 6 and 43 DF,  p-value: 0.33
slm2 <- step(slm02, direction = "both")
## Start:  AIC=-334.03
## fa_mean_4 ~ age + IS + IV + RA + actalph + fact
## 
##           Df Sum of Sq      RSS     AIC
## - IS       1 0.0000024 0.047428 -336.03
## - IV       1 0.0000255 0.047451 -336.00
## - fact     1 0.0005530 0.047979 -335.45
## - RA       1 0.0006190 0.048045 -335.38
## - age      1 0.0009233 0.048349 -335.07
## <none>                 0.047426 -334.03
## - actalph  1 0.0038148 0.051241 -332.16
## 
## Step:  AIC=-336.03
## fa_mean_4 ~ age + IV + RA + actalph + fact
## 
##           Df Sum of Sq      RSS     AIC
## - IV       1 0.0000282 0.047456 -338.00
## - RA       1 0.0008103 0.048238 -337.18
## - fact     1 0.0009461 0.048374 -337.04
## - age      1 0.0009791 0.048407 -337.01
## <none>                 0.047428 -336.03
## - actalph  1 0.0039169 0.051345 -334.06
## + IS       1 0.0000024 0.047426 -334.03
## 
## Step:  AIC=-338
## fa_mean_4 ~ age + RA + actalph + fact
## 
##           Df Sum of Sq      RSS     AIC
## - RA       1 0.0008925 0.048349 -339.07
## - fact     1 0.0009685 0.048425 -338.99
## - age      1 0.0010127 0.048469 -338.94
## <none>                 0.047456 -338.00
## - actalph  1 0.0038897 0.051346 -336.06
## + IV       1 0.0000282 0.047428 -336.03
## + IS       1 0.0000051 0.047451 -336.00
## 
## Step:  AIC=-339.07
## fa_mean_4 ~ age + actalph + fact
## 
##           Df Sum of Sq      RSS     AIC
## - fact     1 0.0005482 0.048897 -340.50
## - age      1 0.0011354 0.049484 -339.91
## <none>                 0.048349 -339.07
## + RA       1 0.0008925 0.047456 -338.00
## - actalph  1 0.0034013 0.051750 -337.67
## + IS       1 0.0001872 0.048162 -337.26
## + IV       1 0.0001104 0.048238 -337.18
## 
## Step:  AIC=-340.5
## fa_mean_4 ~ age + actalph
## 
##           Df Sum of Sq      RSS     AIC
## - age      1 0.0016310 0.050528 -340.86
## <none>                 0.048897 -340.50
## + fact     1 0.0005482 0.048349 -339.07
## + RA       1 0.0004721 0.048425 -338.99
## + IS       1 0.0000209 0.048876 -338.52
## - actalph  1 0.0040558 0.052953 -338.52
## + IV       1 0.0000006 0.048896 -338.50
## 
## Step:  AIC=-340.86
## fa_mean_4 ~ actalph
## 
##           Df Sum of Sq      RSS     AIC
## <none>                 0.050528 -340.86
## + age      1 0.0016310 0.048897 -340.50
## + fact     1 0.0010438 0.049484 -339.91
## + RA       1 0.0004522 0.050076 -339.31
## + IS       1 0.0000038 0.050524 -338.87
## + IV       1 0.0000028 0.050525 -338.87
## - actalph  1 0.0047703 0.055298 -338.35
summary(slm2)
## 
## Call:
## lm(formula = fa_mean_4 ~ actalph, data = stepdata)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.082204 -0.022673  0.000078  0.022388  0.054712 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.65044    0.01505  43.206   <2e-16 ***
## actalph      0.06858    0.03221   2.129   0.0384 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03244 on 48 degrees of freedom
## Multiple R-squared:  0.08626,    Adjusted R-squared:  0.06723 
## F-statistic: 4.532 on 1 and 48 DF,  p-value: 0.03843
AIC(slm2)
## [1] -196.9686
#young adults
#body - highest correlation values
#IV-, RA+
stepdata <- select(ya_data, age, IS:RA, actalph:fact, -rsqact, -actwidthratio, md_mean_4)
summary(slm02y <- lm(md_mean_4 ~ ., data = stepdata))
## 
## Call:
## lm(formula = md_mean_4 ~ ., data = stepdata)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -4.088e-05 -7.751e-06 -7.970e-07  9.215e-06  2.918e-05 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.381e-04  1.868e-05  23.458   <2e-16 ***
## age          1.912e-07  5.891e-07   0.325   0.7471    
## IS           2.352e-05  2.871e-05   0.819   0.4175    
## IV          -2.430e-05  1.068e-05  -2.274   0.0283 *  
## RA           2.220e-05  1.955e-05   1.135   0.2628    
## actalph      2.529e-06  1.597e-05   0.158   0.8750    
## fact        -7.394e-10  1.401e-09  -0.528   0.6006    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.462e-05 on 41 degrees of freedom
## Multiple R-squared:  0.2718, Adjusted R-squared:  0.1652 
## F-statistic: 2.551 on 6 and 41 DF,  p-value: 0.03428
slm2y <- step(slm02y, direction = "both")
## Start:  AIC=-1062.37
## md_mean_4 ~ age + IS + IV + RA + actalph + fact
## 
##           Df  Sum of Sq        RSS     AIC
## - actalph  1 5.3500e-12 8.7643e-09 -1064.3
## - age      1 2.2510e-11 8.7814e-09 -1064.2
## - fact     1 5.9460e-11 8.8184e-09 -1064.0
## - IS       1 1.4334e-10 8.9023e-09 -1063.6
## - RA       1 2.7544e-10 9.0344e-09 -1062.9
## <none>                  8.7589e-09 -1062.4
## - IV       1 1.1047e-09 9.8636e-09 -1058.7
## 
## Step:  AIC=-1064.34
## md_mean_4 ~ age + IS + IV + RA + fact
## 
##           Df  Sum of Sq        RSS     AIC
## - age      1 2.1830e-11 8.7861e-09 -1066.2
## - fact     1 5.4950e-11 8.8192e-09 -1066.0
## - IS       1 1.5088e-10 8.9152e-09 -1065.5
## <none>                  8.7643e-09 -1064.3
## - RA       1 3.8479e-10 9.1491e-09 -1064.3
## + actalph  1 5.3500e-12 8.7589e-09 -1062.4
## - IV       1 1.6067e-09 1.0371e-08 -1058.3
## 
## Step:  AIC=-1066.22
## md_mean_4 ~ IS + IV + RA + fact
## 
##           Df  Sum of Sq        RSS     AIC
## - fact     1 4.3320e-11 8.8294e-09 -1068.0
## - IS       1 1.4407e-10 8.9302e-09 -1067.4
## <none>                  8.7861e-09 -1066.2
## - RA       1 3.9516e-10 9.1813e-09 -1066.1
## + age      1 2.1830e-11 8.7643e-09 -1064.3
## + actalph  1 4.6700e-12 8.7814e-09 -1064.2
## - IV       1 1.5897e-09 1.0376e-08 -1060.2
## 
## Step:  AIC=-1067.99
## md_mean_4 ~ IS + IV + RA
## 
##           Df  Sum of Sq        RSS     AIC
## - IS       1 1.1125e-10 8.9407e-09 -1069.4
## - RA       1 3.7091e-10 9.2003e-09 -1068.0
## <none>                  8.8294e-09 -1068.0
## + fact     1 4.3320e-11 8.7861e-09 -1066.2
## + age      1 1.0200e-11 8.8192e-09 -1066.0
## + actalph  1 8.9000e-13 8.8285e-09 -1066.0
## - IV       1 1.5467e-09 1.0376e-08 -1062.2
## 
## Step:  AIC=-1069.39
## md_mean_4 ~ IV + RA
## 
##           Df  Sum of Sq        RSS     AIC
## <none>                  8.9407e-09 -1069.4
## + IS       1 1.1125e-10 8.8294e-09 -1068.0
## + actalph  1 1.3580e-11 8.9271e-09 -1067.5
## + fact     1 1.0510e-11 8.9302e-09 -1067.4
## + age      1 9.9400e-12 8.9307e-09 -1067.4
## - RA       1 1.0221e-09 9.9628e-09 -1066.2
## - IV       1 2.0437e-09 1.0984e-08 -1061.5
summary(slm2y)
## 
## Call:
## lm(formula = md_mean_4 ~ IV + RA, data = stepdata)
## 
## Residuals:
##        Min         1Q     Median         3Q        Max 
## -4.117e-05 -7.563e-06  2.260e-07  1.093e-05  2.956e-05 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  4.419e-04  1.360e-05  32.489  < 2e-16 ***
## IV          -2.614e-05  8.151e-06  -3.207  0.00247 ** 
## RA           3.050e-05  1.345e-05   2.268  0.02817 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.41e-05 on 45 degrees of freedom
## Multiple R-squared:  0.2567, Adjusted R-squared:  0.2237 
## F-statistic:  7.77 on 2 and 45 DF,  p-value: 0.001263
#age+, fact+NS
stepdata <- select(ya_data, age, IS:RA, actalph:fact, -rsqact, -actwidthratio, fa_mean_4)
summary(slm02y <- lm(fa_mean_4 ~ ., data = stepdata))
## 
## Call:
## lm(formula = fa_mean_4 ~ ., data = stepdata)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.041839 -0.009620  0.001603  0.009002  0.049126 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  6.166e-01  2.727e-02  22.612   <2e-16 ***
## age          1.655e-03  8.601e-04   1.924   0.0614 .  
## IS           3.621e-02  4.192e-02   0.864   0.3928    
## IV          -2.837e-03  1.560e-02  -0.182   0.8566    
## RA          -3.559e-02  2.855e-02  -1.247   0.2196    
## actalph     -1.090e-02  2.332e-02  -0.467   0.6428    
## fact         2.885e-06  2.046e-06   1.410   0.1662    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.02134 on 41 degrees of freedom
## Multiple R-squared:  0.2018, Adjusted R-squared:  0.08496 
## F-statistic: 1.727 on 6 and 41 DF,  p-value: 0.139
slm2y <- step(slm02y, direction = "both")
## Start:  AIC=-362.89
## fa_mean_4 ~ age + IS + IV + RA + actalph + fact
## 
##           Df  Sum of Sq      RSS     AIC
## - IV       1 0.00001506 0.018686 -364.86
## - actalph  1 0.00009942 0.018771 -364.64
## - IS       1 0.00033975 0.019011 -364.03
## - RA       1 0.00070778 0.019379 -363.11
## <none>                  0.018671 -362.89
## - fact     1 0.00090504 0.019576 -362.62
## - age      1 0.00168511 0.020356 -360.75
## 
## Step:  AIC=-364.86
## fa_mean_4 ~ age + IS + RA + actalph + fact
## 
##           Df  Sum of Sq      RSS     AIC
## - actalph  1 0.00008641 0.018773 -366.63
## - IS       1 0.00049196 0.019178 -365.61
## <none>                  0.018686 -364.86
## - RA       1 0.00091373 0.019600 -364.56
## - fact     1 0.00092213 0.019608 -364.54
## + IV       1 0.00001506 0.018671 -362.89
## - age      1 0.00167221 0.020359 -362.74
## 
## Step:  AIC=-366.63
## fa_mean_4 ~ age + IS + RA + fact
## 
##           Df  Sum of Sq      RSS     AIC
## - IS       1 0.00069625 0.019469 -366.89
## <none>                  0.018773 -366.63
## - fact     1 0.00083900 0.019612 -366.54
## - RA       1 0.00121672 0.019989 -365.62
## + actalph  1 0.00008641 0.018686 -364.86
## + IV       1 0.00000204 0.018771 -364.64
## - age      1 0.00178611 0.020559 -364.27
## 
## Step:  AIC=-366.89
## fa_mean_4 ~ age + RA + fact
## 
##           Df  Sum of Sq      RSS     AIC
## - RA       1 0.00061567 0.020085 -367.39
## <none>                  0.019469 -366.89
## + IS       1 0.00069625 0.018773 -366.63
## + actalph  1 0.00029070 0.019178 -365.61
## - age      1 0.00156272 0.021032 -365.18
## + IV       1 0.00002663 0.019442 -364.95
## - fact     1 0.00169389 0.021163 -364.88
## 
## Step:  AIC=-367.39
## fa_mean_4 ~ age + fact
## 
##           Df  Sum of Sq      RSS     AIC
## <none>                  0.020085 -367.39
## + RA       1 0.00061567 0.019469 -366.89
## - fact     1 0.00123287 0.021317 -366.53
## + actalph  1 0.00044599 0.019639 -366.47
## - age      1 0.00150106 0.021586 -365.93
## + IS       1 0.00009520 0.019989 -365.62
## + IV       1 0.00004744 0.020037 -365.51
summary(slm2y)
## 
## Call:
## lm(formula = fa_mean_4 ~ age + fact, data = stepdata)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.04646 -0.01031  0.00089  0.01160  0.05280 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 6.066e-01  1.835e-02  33.054   <2e-16 ***
## age         1.527e-03  8.327e-04   1.834   0.0733 .  
## fact        2.883e-06  1.735e-06   1.662   0.1035    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.02113 on 45 degrees of freedom
## Multiple R-squared:  0.1413, Adjusted R-squared:  0.1032 
## F-statistic: 3.704 on 2 and 45 DF,  p-value: 0.03243

Leave One Out Cross Validation for Stepwise Linear Models

library(beset)
## Loading required package: foreach
## 
## Attaching package: 'foreach'
## The following objects are masked from 'package:purrr':
## 
##     accumulate, when
## Loading required package: Matrix
## 
## Attaching package: 'Matrix'
## The following objects are masked from 'package:tidyr':
## 
##     expand, pack, unpack
## Loading required package: splines
## Loading required package: stats4
stepdata <- select(oa_data, age, IS:RA, actalph:fact, -actwidthratio, fa_mean_4)
mod01 <- (slm02 <- lm(fa_mean_4 ~ ., data = stepdata, direction = "both"))
## Warning: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
##  extra argument 'direction' will be disregarded
summary(mod01)
## 
## Call:
## lm(formula = fa_mean_4 ~ ., data = stepdata, direction = "both")
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.081489 -0.015179 -0.000762  0.019648  0.053460 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  7.171e-01  8.154e-02   8.795 4.48e-11 ***
## age         -8.254e-04  9.261e-04  -0.891   0.3779    
## IS           1.124e-02  5.708e-02   0.197   0.8449    
## IV           5.458e-03  2.329e-02   0.234   0.8159    
## RA          -2.980e-03  6.307e-02  -0.047   0.9625    
## actalph      6.470e-02  3.492e-02   1.853   0.0709 .  
## rsqact      -1.969e-01  2.573e-01  -0.765   0.4483    
## fact         1.162e-05  1.245e-05   0.933   0.3562    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03337 on 42 degrees of freedom
## Multiple R-squared:  0.1542, Adjusted R-squared:  0.01319 
## F-statistic: 1.094 on 7 and 42 DF,  p-value: 0.3848
mod <- beset_lm(fa_mean_4 ~ ., data = stepdata, n_folds = 51, force_in = "age")
## Performing leave-one-out cross-validation
## NOTE: Repetitions of leave-one-out cross-validation
## are pointless and will not be performed.
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
plot(mod)

#return the model with the smallest number of parameters that is within one standard error of the model with the lowest cross-validation error (the “1-SE rule”).
summary(mod, n_folds = 51)
## 
## ======================================================= 
## Best Model:
##   ~ age 
## 
## Coefficients:
##              Estimate
## (Intercept)  0.703800
## age         -0.001233
## 
## (Dispersion parameter for gaussian family taken to be 0.001103185)
## 
## Log-likelihood: 100.3 on 3 Df
## AIC: -194.62
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0.04
## Cross-validated R-squared =  -0.03
## =======================================================
#without 1-SE rule
summary(mod, oneSE = FALSE, n_folds = 51) #age, RA, alpha
## 
## ======================================================= 
## Best Model:
##   ~ age + actalph 
## 
## Coefficients:
##              Estimate
## (Intercept)  0.718700
## age         -0.001036
## actalph      0.063700
## 
## (Dispersion parameter for gaussian family taken to be 0.001040363)
## 
## Log-likelihood: 102.3 on 4 Df
## AIC: -196.61
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0.12
## Cross-validated R-squared =  0
## =======================================================
#aic
summary(mod, metric = "aic", n_folds = 51) 
## 
## ======================================================= 
## Best Model:
##   ~ age + actalph 
## 
## Coefficients:
##              Estimate
## (Intercept)  0.718700
## age         -0.001036
## actalph      0.063700
## 
## (Dispersion parameter for gaussian family taken to be 0.001040363)
## 
## Log-likelihood: 102.3 on 4 Df
## AIC: -196.61
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0.12
## Cross-validated R-squared =  0
## =======================================================
library(beset)
stepdata <- select(oa_data, age, IS:RA, actalph:fact, -actwidthratio, md_mean_4)

mod <- beset_lm(md_mean_4 ~ ., data = stepdata, n_folds = 51, force_in = "age")
## Performing leave-one-out cross-validation
## NOTE: Repetitions of leave-one-out cross-validation
## are pointless and will not be performed.
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
plot(mod)

#return the model with the smallest number of parameters that is within one standard error of the model with the lowest cross-validation error (the “1-SE rule”).
summary(mod, n_folds = 51)
## 
## ======================================================= 
## Best Model:
##   ~ age 
## 
## Coefficients:
##              Estimate
## (Intercept) 3.921e-04
## age         1.139e-06
## 
## (Dispersion parameter for gaussian family taken to be 4.439699e-10)
## 
## Log-likelihood: 468.5 on 3 Df
## AIC: -930.91
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0.09
## Cross-validated R-squared =  0.02
## =======================================================
#without 1-SE rule
summary(mod, oneSE = FALSE, n_folds = 51) #age, RA, alpha
## 
## ======================================================= 
## Best Model:
##   ~ age + RA + actalph 
## 
## Coefficients:
##               Estimate
## (Intercept)  3.438e-04
## age          9.670e-07
## RA           3.636e-05
## actalph     -6.563e-05
## 
## (Dispersion parameter for gaussian family taken to be 3.655151e-10)
## 
## Log-likelihood: 474.4 on 5 Df
## AIC: -938.76
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0.28
## Cross-validated R-squared =  0.16
## =======================================================
#aic
summary(mod, metric = "aic", n_folds = 51) 
## 
## ======================================================= 
## Best Model:
##   ~ age + RA + actalph 
## 
## Coefficients:
##               Estimate
## (Intercept)  3.438e-04
## age          9.670e-07
## RA           3.636e-05
## actalph     -6.563e-05
## 
## (Dispersion parameter for gaussian family taken to be 3.655151e-10)
## 
## Log-likelihood: 474.4 on 5 Df
## AIC: -938.76
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0.28
## Cross-validated R-squared =  0.16
## =======================================================

Any correlations with neuropsych measures?

# correlation plots
alpha = 0.05

d$ef <- (d$trails_b_z_score + d$ds_zscore)/2
oa_data <- filter(d, Group == "Older Adults")
oa_mat <- cor(select(oa_data, actalph, actwidthratio, ef, matches("zscore|z_score")))
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")

oa_data <- filter(d, Group == "Older Adults")
oa_mat <- cor(select(oa_data, matches("fa_mean|md_mean"), matches("zscore|z_score")))
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")

#addCoef.col = TRUE, number.cex = .6

Do cowat and width (alpha) account for separate variance in FA?

summary(lm(fa_mean_4 ~ cowat_zscore + actalph, data = oa_data))
## 
## Call:
## lm(formula = fa_mean_4 ~ cowat_zscore + actalph, data = oa_data)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.073588 -0.020417 -0.002005  0.018799  0.062497 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.641163   0.015051  42.599   <2e-16 ***
## cowat_zscore 0.010726   0.004805   2.232   0.0304 *  
## actalph      0.054462   0.031594   1.724   0.0913 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.03118 on 47 degrees of freedom
## Multiple R-squared:  0.1739, Adjusted R-squared:  0.1387 
## F-statistic: 4.946 on 2 and 47 DF,  p-value: 0.01124

Corpus Callosum Volume Relationships

ccvol <- read_delim("/Volumes/schnyer/Aging_DecMem/Scan_Data/BIDS/derivatives/freesurfer/aseg_table.txt", delim = "\t")
## Parsed with column specification:
## cols(
##   .default = col_double(),
##   `Measure:volume` = col_character()
## )
## See spec(...) for full column specifications.
head(ccvol)
## # A tibble: 6 x 27
##   `Measure:volume` CC_Posterior CC_Mid_Posterior CC_Central CC_Mid_Anterior
##   <chr>                   <dbl>            <dbl>      <dbl>           <dbl>
## 1 sub-30004                873.             486        522.            477.
## 2 sub-30012                987.             559.       650.            566.
## 3 sub-30015               1137.             677.       726.            681.
## 4 sub-30019               1008.             563.       570.            399.
## 5 sub-30020                974.             416.       695.            496.
## 6 sub-30040                801.             426.       638.            534 
## # … with 22 more variables: CC_Anterior <dbl>, BrainSegVol <dbl>,
## #   BrainSegVolNotVent <dbl>, BrainSegVolNotVentSurf <dbl>, lhCortexVol <dbl>,
## #   rhCortexVol <dbl>, CortexVol <dbl>, lhCerebralWhiteMatterVol <dbl>,
## #   rhCerebralWhiteMatterVol <dbl>, CerebralWhiteMatterVol <dbl>,
## #   SubCortGrayVol <dbl>, TotalGrayVol <dbl>, SupraTentorialVol <dbl>,
## #   SupraTentorialVolNotVent <dbl>, SupraTentorialVolNotVentVox <dbl>,
## #   MaskVol <dbl>, `BrainSegVol-to-eTIV` <dbl>, `MaskVol-to-eTIV` <dbl>,
## #   lhSurfaceHoles <dbl>, rhSurfaceHoles <dbl>, SurfaceHoles <dbl>,
## #   EstimatedTotalIntraCranialVol <dbl>
library(stringr)
ccvol$CC_Total <- ccvol$CC_Anterior + ccvol$CC_Central + ccvol$CC_Mid_Anterior + ccvol$CC_Mid_Posterior + ccvol$CC_Posterior
ccvol$record_id <- substr(ccvol$`Measure:volume`, 5, 9)
ccvol$record_id
##  [1] "30004" "30012" "30015" "30019" "30020" "30040" "30057" "30066" "30074"
## [10] "30085" "30088" "30090" "30091" "30096" "30105" "30116" "30119" "30128"
## [19] "30181" "30217" "30236" "30283" "30330" "30346" "30376" "30395" "30400"
## [28] "30412" "30426" "30432" "30466" "30469" "30476" "30478" "30568" "30581"
## [37] "30584" "30588" "40160" "40170" "40175" "40351" "40490" "40496" "40500"
## [46] "40512" "40515" "40516" "40520" "40522" "40524" "40547" "40550" "40564"
## [55] "40601" "40608" "40619" "40623" "40649" "40650" "40655" "40658" "40664"
## [64] "40665" "40668" "40685" "40694" "40720" "40728" "40730" "40738" "40743"
## [73] "40750" "40767" "40768" "40769" "40773" "40775" "40777" "40779" "40784"
## [82] "40803" "40855" "40861" "40876" "40878"
d2 <- merge(d, ccvol, by = "record_id")


alpha = 0.05

oa_data <- filter(d2, Group == "Older Adults")
oa_cor_data <- select(oa_data, IS:RA, actamp:fact, matches("CC_"))
oa_cor_data <- oa_cor_data[complete.cases(oa_cor_data),]
oa_mat <- cor(oa_cor_data)
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")

ya_data <- filter(d2, Group == "Young Adults")
ya_cor_data <- select(ya_data, IS:RA, actamp:fact, matches("CC_"))
ya_cor_data <- ya_cor_data[complete.cases(ya_cor_data),]
ya_mat <- cor(ya_cor_data)
ya_res <- cor.mtest(ya_mat, conf.level = (1-alpha))
corrplot(ya_mat, p.mat = ya_res$p, sig.level = alpha, insig = "blank", type = "upper")

all_cor_data <- select(d2, IS:RA, actamp:fact, matches("CC_"))
all_cor_data <- all_cor_data[complete.cases(all_cor_data),]
all_mat <- cor(all_cor_data)
all_res <- cor.mtest(all_mat, conf.level = (1-alpha))
corrplot(all_mat, p.mat = all_res$p, sig.level = alpha, insig = "blank", type = "upper")

Neuropsych z-scores and corpus callosum volume measures in OA

alpha = 0.05

oa_data <- filter(d2, Group == "Older Adults")
oa_cor_data <- select(oa_data, matches("zscore|z_score"), matches("CC_"))
oa_mat <- cor(oa_cor_data)
oa_res <- cor.mtest(oa_mat, conf.level = (1-alpha))
corrplot(oa_mat, p.mat = oa_res$p, sig.level = alpha, insig = "blank", type = "upper")

stepdata <- select(oa_data, age, IS:RA, actalph:fact, -actwidthratio, CC_Total)

library(beset)
mod_fs1 <- beset_lm(CC_Total ~ ., data = stepdata, n_folds = 38)#, force_in = "age")
## Performing leave-one-out cross-validation
## NOTE: Repetitions of leave-one-out cross-validation
## are pointless and will not be performed.
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
summary(mod_fs1, n_folds = 38) #age
## 
## ======================================================= 
## Best Model:
##   ~ age 
## 
## Coefficients:
##             Estimate
## (Intercept)  5610.00
## age           -34.64
## 
## (Dispersion parameter for gaussian family taken to be 131913.6)
## 
## Log-likelihood: -276.9 on 3 Df
## AIC: 559.8
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0.25
## Cross-validated R-squared =  0.15
## =======================================================
summary(mod_fs1, n_folds = 38, oneSE = FALSE) #age, RA, actalph
## 
## ======================================================= 
## Best Model:
##   ~ age + RA + actalph 
## 
## Coefficients:
##             Estimate
## (Intercept)  6518.00
## age           -32.71
## RA           -775.10
## actalph       874.30
## 
## (Dispersion parameter for gaussian family taken to be 121656)
## 
## Log-likelihood: -274.3 on 5 Df
## AIC: 558.55
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0.35
## Cross-validated R-squared =  0.2
## =======================================================
plot(mod_fs1, n_folds = 38, oneSE = FALSE)

Best model without 1 SE rule - age (S), RA, width (S) predict total CC volume

summary(lm(CC_Total ~ age + RA + actalph, data = oa_data))
## 
## Call:
## lm(formula = CC_Total ~ age + RA + actalph, data = oa_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -727.73 -209.44  -39.86  217.81  752.34 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 6518.387    826.750   7.884 3.51e-09 ***
## age          -32.707      9.654  -3.388  0.00179 ** 
## RA          -775.059    524.124  -1.479  0.14841    
## actalph      874.332    425.083   2.057  0.04744 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 348.8 on 34 degrees of freedom
## Multiple R-squared:  0.3468, Adjusted R-squared:  0.2892 
## F-statistic: 6.018 on 3 and 34 DF,  p-value: 0.002108
oa_data %>%
  ggplot() +
  geom_point(aes(x = actalph, y = CC_Total)) +
  stat_smooth(aes(x = actalph, y = CC_Total), method = "lm") + 
  scale_color_manual(values = c("blue")) +
  xlab("Width (alpha)") + ylab("Corpus Callosum Volume") 

CR Measures and CC Volume

#No significant interaction effect
summary(lm(CC_Total ~ IS * Group, data = d2))
## 
## Call:
## lm(formula = CC_Total ~ IS * Group, data = d2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1176.99  -270.15    29.94   243.05  1023.88 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            3925.2      226.3  17.343   <2e-16 ***
## IS                     -265.4      561.5  -0.473   0.6380    
## GroupOlder Adults      -631.6      334.6  -1.888   0.0633 .  
## IS:GroupOlder Adults    180.7      746.7   0.242   0.8095    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 410 on 69 degrees of freedom
## Multiple R-squared:  0.3399, Adjusted R-squared:  0.3112 
## F-statistic: 11.85 on 3 and 69 DF,  p-value: 2.391e-06
summary(lm(CC_Total ~ IV * Group, data = d2))
## 
## Call:
## lm(formula = CC_Total ~ IV * Group, data = d2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1166.45  -247.79    50.13   225.23  1025.53 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           3718.58     242.38  15.342   <2e-16 ***
## IV                     119.17     264.13   0.451   0.6533    
## GroupOlder Adults     -572.59     340.54  -1.681   0.0972 .  
## IV:GroupOlder Adults    15.51     392.13   0.040   0.9686    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 409.5 on 69 degrees of freedom
## Multiple R-squared:  0.3415, Adjusted R-squared:  0.3129 
## F-statistic: 11.93 on 3 and 69 DF,  p-value: 2.206e-06
summary(lm(CC_Total ~ RA * Group, data = d2))
## 
## Call:
## lm(formula = CC_Total ~ RA * Group, data = d2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1147.09  -242.33    20.27   259.65  1051.30 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            4033.4      346.0  11.656   <2e-16 ***
## RA                     -255.3      412.2  -0.619    0.538    
## GroupOlder Adults      -421.8      610.6  -0.691    0.492    
## RA:GroupOlder Adults   -165.2      715.1  -0.231    0.818    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 408.1 on 69 degrees of freedom
## Multiple R-squared:  0.3461, Adjusted R-squared:  0.3176 
## F-statistic: 12.17 on 3 and 69 DF,  p-value: 1.748e-06
summary(lm(CC_Total ~ fact * Group, data = d2))
## 
## Call:
## lm(formula = CC_Total ~ fact * Group, data = d2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1094.21  -293.86    17.76   250.17  1171.73 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            3874.95673  164.15259  23.606  < 2e-16 ***
## fact                     -0.01331    0.03854  -0.345  0.73081    
## GroupOlder Adults      -853.16378  233.11524  -3.660  0.00049 ***
## fact:GroupOlder Adults    0.06490    0.05136   1.264  0.21060    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 403.7 on 69 degrees of freedom
## Multiple R-squared:   0.36,  Adjusted R-squared:  0.3322 
## F-statistic: 12.94 on 3 and 69 DF,  p-value: 8.448e-07
summary(lm(CC_Central ~ fact * Group, data = d2))
## 
## Call:
## lm(formula = CC_Central ~ fact * Group, data = d2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -244.000  -80.220   -9.062   64.287  274.186 
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             5.806e+02  4.441e+01  13.074  < 2e-16 ***
## fact                    1.946e-02  1.043e-02   1.867  0.06621 .  
## GroupOlder Adults      -1.749e+02  6.307e+01  -2.774  0.00712 ** 
## fact:GroupOlder Adults -6.459e-03  1.389e-02  -0.465  0.64350    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 109.2 on 69 degrees of freedom
## Multiple R-squared:  0.4727, Adjusted R-squared:  0.4498 
## F-statistic: 20.62 on 3 and 69 DF,  p-value: 1.204e-09
#Significant age group effect
summary(lm(CC_Total ~ IS + Group, data = d2))
## 
## Call:
## lm(formula = CC_Total ~ IS + Group, data = d2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1182.65  -288.37    46.67   243.44  1012.72 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         3886.0      157.0  24.756  < 2e-16 ***
## IS                  -163.2      367.7  -0.444    0.658    
## GroupOlder Adults   -554.5      102.0  -5.435 7.54e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 407.3 on 70 degrees of freedom
## Multiple R-squared:  0.3394, Adjusted R-squared:  0.3205 
## F-statistic: 17.98 on 2 and 70 DF,  p-value: 4.991e-07
summary(lm(CC_Total ~ IV + Group, data = d2))
## 
## Call:
## lm(formula = CC_Total ~ IV + Group, data = d2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1166.73  -249.09    49.88   221.73  1026.18 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        3712.39     183.79  20.199  < 2e-16 ***
## IV                  126.21     193.83   0.651    0.517    
## GroupOlder Adults  -559.68      96.72  -5.786 1.86e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 406.6 on 70 degrees of freedom
## Multiple R-squared:  0.3415, Adjusted R-squared:  0.3227 
## F-statistic: 18.15 on 2 and 70 DF,  p-value: 4.458e-07
summary(lm(CC_Total ~ RA + Group, data = d2))
## 
## Call:
## lm(formula = CC_Total ~ RA + Group, data = d2)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1153.33  -244.63    17.54   265.94  1047.26 
## 
## Coefficients:
##                   Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        4078.54     283.60  14.381  < 2e-16 ***
## RA                 -310.19     334.56  -0.927    0.357    
## GroupOlder Adults  -561.03      95.52  -5.873 1.31e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 405.3 on 70 degrees of freedom
## Multiple R-squared:  0.3456, Adjusted R-squared:  0.3269 
## F-statistic: 18.48 on 2 and 70 DF,  p-value: 3.592e-07
summary(lm(CC_Total ~ fact + Group, data = d2))
## 
## Call:
## lm(formula = CC_Total ~ fact + Group, data = d2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -1136.4  -309.6    38.5   274.7  1097.1 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       3733.39115  120.49458  30.984  < 2e-16 ***
## fact                 0.02323    0.02558   0.908    0.367    
## GroupOlder Adults -584.62071   96.23509  -6.075 5.78e-08 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 405.4 on 70 degrees of freedom
## Multiple R-squared:  0.3452, Adjusted R-squared:  0.3265 
## F-statistic: 18.45 on 2 and 70 DF,  p-value: 3.655e-07
summary(lm(CC_Central ~ fact + Group, data = d2))
## 
## Call:
## lm(formula = CC_Central ~ fact + Group, data = d2)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -246.15  -72.85  -11.97   63.99  270.79 
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)        5.947e+02  3.228e+01  18.424  < 2e-16 ***
## fact               1.582e-02  6.853e-03   2.309   0.0239 *  
## GroupOlder Adults -2.017e+02  2.578e+01  -7.823 3.87e-11 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 108.6 on 70 degrees of freedom
## Multiple R-squared:  0.4711, Adjusted R-squared:  0.4559 
## F-statistic: 31.17 on 2 and 70 DF,  p-value: 2.085e-10
summary(lm(CC_Mid_Anterior ~ fact, data = d2[d2$Group == "Older Adults",])) #NS
## 
## Call:
## lm(formula = CC_Mid_Anterior ~ fact, data = d2[d2$Group == "Older Adults", 
##     ])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -187.220  -57.985   -3.417   44.276  248.820 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 4.010e+02  3.583e+01  11.192 2.82e-13 ***
## fact        1.024e-02  7.349e-03   1.394    0.172    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 87.39 on 36 degrees of freedom
## Multiple R-squared:  0.05118,    Adjusted R-squared:  0.02483 
## F-statistic: 1.942 on 1 and 36 DF,  p-value: 0.172
summary(lm(CC_Mid_Anterior ~ fact + age, data = d2[d2$Group == "Older Adults",])) #NS
## 
## Call:
## lm(formula = CC_Mid_Anterior ~ fact + age, data = d2[d2$Group == 
##     "Older Adults", ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -112.37  -52.23    1.03   36.13  235.25 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 895.035485 162.536047   5.507 3.45e-06 ***
## fact          0.005010   0.006813   0.735   0.4670    
## age          -6.915642   2.230121  -3.101   0.0038 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 78.5 on 35 degrees of freedom
## Multiple R-squared:  0.2557, Adjusted R-squared:  0.2132 
## F-statistic: 6.011 on 2 and 35 DF,  p-value: 0.005699
summary(lm(CC_Central ~ fact, data = d2[d2$Group == "Older Adults",])) # p = 0.06
## 
## Call:
## lm(formula = CC_Central ~ fact, data = d2[d2$Group == "Older Adults", 
##     ])
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -124.548  -51.769   -8.831   22.865  180.833 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 4.057e+02  3.285e+01   12.35 1.67e-14 ***
## fact        1.300e-02  6.739e-03    1.93   0.0616 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 80.13 on 36 degrees of freedom
## Multiple R-squared:  0.09373,    Adjusted R-squared:  0.06856 
## F-statistic: 3.723 on 1 and 36 DF,  p-value: 0.06157
summary(lm(CC_Central ~ fact + age, data = d2[d2$Group == "Older Adults",])) #NS
## 
## Call:
## lm(formula = CC_Central ~ fact + age, data = d2[d2$Group == "Older Adults", 
##     ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -105.37  -61.75  -10.31   27.42  204.04 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 649.794432 162.918364   3.988 0.000323 ***
## fact          0.010418   0.006829   1.525 0.136140    
## age          -3.417460   2.235366  -1.529 0.135299    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 78.68 on 35 degrees of freedom
## Multiple R-squared:  0.1505, Adjusted R-squared:  0.1019 
## F-statistic: 3.099 on 2 and 35 DF,  p-value: 0.05764
summary(lm(CC_Central ~ fact, data = d2[d2$Group == "Young Adults",])) #NS
## 
## Call:
## lm(formula = CC_Central ~ fact, data = d2[d2$Group == "Young Adults", 
##     ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -244.00 -117.13  -14.46   96.19  274.19 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 580.60337   54.45826  10.661 3.18e-12 ***
## fact          0.01946    0.01279   1.522    0.137    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 133.9 on 33 degrees of freedom
## Multiple R-squared:  0.0656, Adjusted R-squared:  0.03729 
## F-statistic: 2.317 on 1 and 33 DF,  p-value: 0.1375
summary(lm(CC_Central ~ fact + age, data = d2[d2$Group == "Young Adults",])) #NS
## 
## Call:
## lm(formula = CC_Central ~ fact + age, data = d2[d2$Group == "Young Adults", 
##     ])
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -244.47 -115.92  -12.71   94.44  271.58 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 603.77570  131.55795   4.589 6.53e-05 ***
## fact          0.02010    0.01339   1.501    0.143    
## age          -1.18107    6.08493  -0.194    0.847    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 135.9 on 32 degrees of freedom
## Multiple R-squared:  0.0667, Adjusted R-squared:  0.008372 
## F-statistic: 1.144 on 2 and 32 DF,  p-value: 0.3314
#Significant effect of age
summary(lm(CC_Total ~ actalph, data = oa_data)) #p = 0.06
## 
## Call:
## lm(formula = CC_Total ~ actalph, data = oa_data)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1162.80  -165.11   -34.94   178.15   959.06 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   3610.6      211.3  17.087   <2e-16 ***
## actalph        826.9      464.4   1.781   0.0834 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 402.1 on 36 degrees of freedom
## Multiple R-squared:  0.08093,    Adjusted R-squared:  0.0554 
## F-statistic:  3.17 on 1 and 36 DF,  p-value: 0.08343
summary(lm(CC_Total ~ actalph+age, data = oa_data)) #but effect goes away when include age
## 
## Call:
## lm(formula = CC_Total ~ actalph + age, data = oa_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -770.54 -219.30  -45.58  241.32  739.99 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 5790.993    675.671   8.571 4.08e-10 ***
## actalph      683.646    411.862   1.660  0.10587    
## age          -32.950      9.815  -3.357  0.00191 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 354.7 on 35 degrees of freedom
## Multiple R-squared:  0.3048, Adjusted R-squared:  0.2651 
## F-statistic: 7.673 on 2 and 35 DF,  p-value: 0.001725
#from corplots
summary(lm(CC_Mid_Anterior ~ actalph + age, data = oa_data)) #NS
## 
## Call:
## lm(formula = CC_Mid_Anterior ~ actalph + age, data = oa_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -117.51  -48.46  -13.07   38.61  220.10 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  979.206    146.406   6.688 9.68e-08 ***
## actalph      128.841     89.243   1.444  0.15771    
## age           -7.004      2.127  -3.293  0.00227 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 76.85 on 35 degrees of freedom
## Multiple R-squared:  0.2867, Adjusted R-squared:  0.2459 
## F-statistic: 7.033 on 2 and 35 DF,  p-value: 0.002708
summary(lm(CC_Central ~ actalph + age, data = oa_data)) #NS
## 
## Call:
## lm(formula = CC_Central ~ actalph + age, data = oa_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -112.35  -47.05  -16.64   28.33  193.78 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  782.021    151.976   5.146 1.03e-05 ***
## actalph      106.263     92.638   1.147   0.2591    
## age           -3.999      2.208  -1.812   0.0786 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 79.77 on 35 degrees of freedom
## Multiple R-squared:  0.1268, Adjusted R-squared:  0.07691 
## F-statistic: 2.541 on 2 and 35 DF,  p-value: 0.0932
summary(lm(CC_Total ~ actwidthratio, data = ya_data)) #NS
## 
## Call:
## lm(formula = CC_Total ~ actwidthratio, data = ya_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -762.72 -287.87   31.78  296.50  793.36 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)     4253.0      718.8   5.917 1.23e-06 ***
## actwidthratio   -649.8     1082.4  -0.600    0.552    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 399 on 33 degrees of freedom
## Multiple R-squared:  0.0108, Adjusted R-squared:  -0.01917 
## F-statistic: 0.3604 on 1 and 33 DF,  p-value: 0.5524
summary(lm(CC_Total ~ actbeta, data = ya_data)) #NS
## 
## Call:
## lm(formula = CC_Total ~ actbeta, data = ya_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -753.13 -319.56   32.59  288.69  763.98 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 3785.642    183.231  20.661   <2e-16 ***
## actbeta        5.771     26.030   0.222    0.826    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 400.8 on 33 degrees of freedom
## Multiple R-squared:  0.001487,   Adjusted R-squared:  -0.02877 
## F-statistic: 0.04915 on 1 and 33 DF,  p-value: 0.8259

PVT

Predictors of relative response time and false starts?

pvt <- read_csv("~/Box/CogNeuroLab/Aging Decision Making R01/Analysis/pvt/pvt_stats_2019-12-11.csv")
## Parsed with column specification:
## cols(
##   record_id = col_double(),
##   rt_mean = col_double(),
##   rt_sd = col_double(),
##   fs = col_double(),
##   rl = col_double()
## )
head(pvt)
## # A tibble: 6 x 5
##   record_id rt_mean rt_sd    fs    rl
##       <dbl>   <dbl> <dbl> <dbl> <dbl>
## 1     30003    270.  75.3     2     0
## 2     30004    315. 166.      2     0
## 3     30008    295.  85.3     1     0
## 4     30008    327.  76.8     0     0
## 5     30009    321. 209.      0     0
## 6     30012    290.  61.5     1     0
d2 <- merge(d2, pvt, by = "record_id")

oa_data <- filter(d2, Group == "Older Adults")

library(beset)
stepdata <- select(oa_data, age, IS:RA, actalph:fact, -actwidthratio, matches("fa_mean|md_mean|CC_"), rt_mean)

mod_rt1 <- beset_lm(rt_mean ~ ., data = stepdata, n_folds = 38)#, force_in = "age")
## Warning in check_lindep(data): Found 1 linear dependency.  Removed the following predictor:
##  CC_Total
## Performing leave-one-out cross-validation
## NOTE: Repetitions of leave-one-out cross-validation
## are pointless and will not be performed.
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
summary(mod_rt1, n_folds = 38) #NS
## 
## ======================================================= 
## Best Model:
##   ~ 1 
## 
## Coefficients:
##             Estimate
## (Intercept)    340.8
## 
## (Dispersion parameter for gaussian family taken to be 72423.21)
## 
## Log-likelihood:  -266 on 2 Df
## AIC: 536.06
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0
## Cross-validated R-squared =  -0.05
## =======================================================
summary(mod_rt1, n_folds = 38, oneSE = FALSE) #NS
## 
## ======================================================= 
## Best Model:
##   ~ 1 
## 
## Coefficients:
##             Estimate
## (Intercept)    340.8
## 
## (Dispersion parameter for gaussian family taken to be 72423.21)
## 
## Log-likelihood:  -266 on 2 Df
## AIC: 536.06
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0
## Cross-validated R-squared =  -0.05
## =======================================================
plot(mod_rt1, n_folds = 38, oneSE = FALSE)

stepdata <- select(oa_data, age, IS:RA, actalph:fact, -actwidthratio, matches("fa_mean|md_mean|CC_"), fs)

mod_fs1 <- beset_lm(fs ~ ., data = stepdata, n_folds = 38)#, force_in = "age")
## Warning in check_lindep(data): Found 1 linear dependency.  Removed the following predictor:
##  CC_Total
## Performing leave-one-out cross-validation
## NOTE: Repetitions of leave-one-out cross-validation
## are pointless and will not be performed.
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
## Performing leave-one-out cross-validation
summary(mod_fs1, n_folds = 38) 
## 
## ======================================================= 
## Best Model:
##   ~ 1 
## 
## Coefficients:
##             Estimate
## (Intercept)    3.132
## 
## (Dispersion parameter for gaussian family taken to be 44.11735)
## 
## Log-likelihood: -125.4 on 2 Df
## AIC: 254.73
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0
## Cross-validated R-squared =  -0.05
## =======================================================
summary(mod_fs1, n_folds = 38, oneSE = FALSE) 
## 
## ======================================================= 
## Best Model:
##   ~ 1 
## 
## Coefficients:
##             Estimate
## (Intercept)    3.132
## 
## (Dispersion parameter for gaussian family taken to be 44.11735)
## 
## Log-likelihood: -125.4 on 2 Df
## AIC: 254.73
## 
## Number of Fisher Scoring iterations: 2
## 
## Train-sample R-squared = 0
## Cross-validated R-squared =  -0.05
## =======================================================
plot(mod_fs1, n_folds = 38, oneSE = FALSE)

12/10 To Do: